<script setup>
import { RouterView } from 'vue-router';
import Login from './views/Login.vue';
import { onMounted, ref } from 'vue';
import request from './apis/request';
import router from './router';


// let captchaUrl = ref('http://localhost:8080/api/captcha');
// let handleClick = () => {
//   // 更新URL以强制浏览器重新加载图片, 加时间戳,避免浏览器缓存
//   captchaUrl.value = 'http://localhost:8080/api/captcha?t=' + new Date().getTime();
// }
// fetch("http://localhost:8080/api/user/list",{
//     method: "GET",
//     headers:{
//       "Content-Type":"application/json",
//       "Authorization":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGFpbXMiOnsidXNlcm5hbWUiOiI5OTk5In0sImV4cCI6MTcyODM5Njk3NX0.7m_K1zy6D6C0kB7G7qI76pIQvgi_su1-k5ATHR74bc0"
//     },
//     body:null
// }).then(res => {
//     return res.json();
// }).then(data => {
//     console.log(data);
// })


// const params = new URLSearchParams();
// params.append("username", "8888");
// params.append("password", "123456");
// const result = request.post('/api/user/login',params.toString(),{
//     headers:{
//         'Content-Type':'application/x-www-form-urlencoded'
//     }
// }).then(res => {
//    console.log(res);
// })

// 页面刷新后自动跳转到首页
onMounted(() => {
  router.replace('/index')
})

</script>

<template>
  <!-- <div>你好，世界！</div> -->
  <!-- <div>
    <img :src=captchaUrl alt="验证码图片">
    <button @click="handleClick">换一张</button>
  </div> -->
  <RouterView></RouterView>
</template>

<style scoped></style>
